Skip to content

HMTV2-21: generate food timeslot#3

Open
jasutiin wants to merge 14 commits intomainfrom
HMTV2-21-generate-food-timeslot
Open

HMTV2-21: generate food timeslot#3
jasutiin wants to merge 14 commits intomainfrom
HMTV2-21-generate-food-timeslot

Conversation

@jasutiin
Copy link
Contributor

@jasutiin jasutiin commented Feb 10, 2026

This PR doesn't handle assigning users to a meal time slot.

The general flow of creating a meal and scanning users in to a meal is as follows:

  • create meal with meal title, start time, end time (instead of a duration), and the admin that scanned the user in
  • later when scanning users in, the admin selects a meal and then scans each person to that meal, adding a meal attendance record attached to the user and that meal

The reason why I am storing end time instead of a duration is because SQL doesn't have a duration type iirc.

I've also created a new client component in the frontend for testing out this functionality. It has checks for scanning in the same user to the same meal, creating a meal with the same title and start time, and creating a meal with an end time that is before the start time. I didn't style the component because I heard we're moving from SCSS to Tailwind because the previous version of HMT used Tailwind and we're trying to preserve the styles from that version.

my idea is to have a qr code for each user. when we create a meal, we
create a meal attendance record for that user at that meal. they can't
scan again. if we allow leftovers for that meal, we would create another
meal called "{meal} leftovers" or whatever so that they can scan in to
that instead. may get a bit annoying to keep having to create meals for
leftovers if we allow them to line up for leftovers again and again.
i changed the addMeal procedure to be public instead of protected for
now because idk how to handle authentication. this is why i am not using
requireRole in the client component as well. also changed startTime and
endTime to string() without changing it to datetime because had issues
with type mismatch.
added a validation check to ensure endTime is after startTime for meals.
also made it so that meals need to have unique titles and start times.
having the same end time is fine because we could set "Breakfast" to be
from 9am to 10am, and then "Breakfast leftovers" from 9:45am to 10am. it
just means all breakfast related things end at 10am.
implemented a scanUserIn public procedure and added a section in my
meals page to scan in a user for testing purposes
@jasutiin jasutiin force-pushed the HMTV2-21-generate-food-timeslot branch from e23c7ab to 6419d1e Compare February 19, 2026 07:34
@jasutiin jasutiin requested a review from skand088 February 19, 2026 07:51
@jasutiin jasutiin requested a review from skand088 February 23, 2026 15:09
Copy link
Contributor

@burtonjong burtonjong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment

@jasutiin jasutiin requested a review from burtonjong February 25, 2026 21:57
Copy link
Contributor

@skand088 skand088 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

return newMeal;
}),

scanUserIn: protectedProcedure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nitpicky but we have an adminProcedure Fiona created in trpc.ts so we should use it just so the codebase is more cohesive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants